package ReefStats::Schema::ReefStatsDB::Domains;

use strict;
use warnings;
use base 'DBIx::Class';
use ReefStats::Schema::DataTypes;

__PACKAGE__->load_components(qw(PK::Auto Core));
__PACKAGE__->table('domains_');
__PACKAGE__->add_columns(
    id     => { @_int_id, },
    domain => { @_varchar_255, @_not_null, @_no_default, },
    visible => { @_boolean, @_not_null, },
);
__PACKAGE__->set_primary_key('id');
__PACKAGE__->add_unique_constraint( domain => ['domain'] );
__PACKAGE__->belongs_to(
    user => 'ReefStats::Schema::ReefStatsDB::Users',
    { 'foreign.domain_id' => 'self.id' }, { cascade_delete => 0 }
);

1;

__END__

=pod

=head1 NAME

ReefStats::Schema::ReefStatsDB::Domains

=head1 DESCRIPTION

DBIC wrapper around the C<domains> lookup table.

=cut
